package ans.p168;

import test.Entrance;

/**
 * #      168
 * 名称   Excel表列名称
 * 链接   https://leetcode-cn.com/problems/excel-sheet-column-title
 * 题解   [435](https://leetcode-cn.com/problems/excel-sheet-column-title/solution)
 * 通过率 39.0%
 * 难道   简单
 */

public class Solution {
    @Entrance
    public String convertToTitle(int columnNumber) {
        StringBuilder sb = new StringBuilder();
        while (columnNumber  != 0) {
            columnNumber --;
            int c = columnNumber % 26 + 'A';
            columnNumber = columnNumber / 26;
            sb.append((char) c);
        }
        return sb.reverse().toString();
    }
}